<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
Ext.namespace('catalog.catalog.gradeSelect');
catalog.catalog.gradeSelect.SearchPanel = Ext.extend(catalog.ComplexGrid, {
    addGrade:'Adauga nota',
    grade:'Nota',
    date:'Data',
    comment:'Comentariu',
    teza:'Teza',

    initComponent:function() { 
        searchURL = 'displayGradesByStudent.action?studentId=' +<%=request.getParameter("studentId")%>;
        var config = {
			compSet:[{url:0,reader:0,columns:0}],
			searchFields :[[
                            'Note pana la data:', {xtype:'datefield', name:'gradeDTO.date', width:120}
                            ]],
            urls: [searchURL],
	        readers : [[
	            {name: 'value'},
	            {name: 'date'},
	            {name: 'comment'},
	            {name: 'gradeState'}
	        ]],
            columnsArray: [[
                {header: this.grade, width: 100, sortable: true, dataIndex: 'value'},
                {header: this.date, width: 100, sortable: true, dataIndex: 'date'},
                {header: this.comment, width: 180, sortable: true, dataIndex: 'comment'},
                {header: this.teza, width: 180, sortable: true, dataIndex: 'gradeState'}

	        ]],	 
            tbarActions : [{
                text:this.addGrade,
                iconCls :'add-icon',
                scope:this,
                handler:this.addGradeFun
            }]

        }; // eo config object
        Ext.apply(this, Ext.apply(this.initialConfig, config)); 
        catalog.catalog.gradeSelect.SearchPanel.superclass.initComponent.apply(this, arguments);
    },
    addGradeFun :function() {
        var URL = 'catalog/adaugaNota.jsp?studentId=' +<%=request.getParameter("studentId")%>;
        var win = catalog.util.genWindow({
            id: 'addGradeWindow',
            title    : this.addGrade,
            autoLoad : {url:URL,scripts:true},
            width    : 500,
            height   : 360
        });
    }
});


try {gradeSelectLocale();} catch (e) {}

Ext.onReady(function() {
    Ext.QuickTips.init();
    var formPanel = new catalog.catalog.gradeSelect.SearchPanel();
    formPanel.store.reload();
    Ext.WindowMgr.getActive().add(formPanel);
    Ext.WindowMgr.getActive().doLayout();    
});
</script>